package com.gcsoftware.web.utils;

import com.alibaba.fastjson.JSONObject;

import javax.servlet.http.HttpServletRequest;

/**
 * Created by qs on 2018/4/16.
 */
public class JsonUtils {
    public static boolean isJson(String content) {
        try {
            JSONObject jsonStr= JSONObject.parseObject(content);
            return  true;
        } catch (Exception e) {
            return false;
        }
    }

    public static boolean isJson(HttpServletRequest request) {
        if ("application/json".equals(request.getHeader("Accept"))) {
            return true;
        }
        return false;
    }
}
